<template>
  <dialog-editor ref="dialog"></dialog-editor>
</template>

<script>


import DialogEditor from '@/components/DialogEditor'
import dialogMixins from '@/utils/commonDialogMixins'
import {mRequest} from '@/utils/request'

export default {
  mixins: [dialogMixins],
  components: {DialogEditor},
  data() {
    return {
      dataFormConfig: {
        boxAddId: {label: '纸箱入库编号',
          type: 'list',
          list: [],
          placeholder: '纸箱入库编号'},
        // boxInfoId: {label: '纸箱ID'},
        // productId: {label: '产品ID'},
        // orderDetailId: {label: '订单ID'},
        // boxFactoryId: {label: '纸箱厂'},
        dayTime: {
          label: '日期',
          type: 'date'
        },
        boxNumber: {
          label: '退回数量',
          type: 'number'
        },
        unitPrice: {
          label: '单价',
          type: 'number'
        },
        totalPrice: {label: '总价', type: 'number'},
        remark: {label: '备注'}
      }
    }
  },
  methods: {
    init(id) {
      this.dataForm.id = id || 0
      this.initBoxAddInfoIdList('boxAddId')
      this.$refs.dialog.initDialog({
        dataForm: this.dataForm,
        config: this.dataFormConfig,
        dataRule: this.getNeedDataRule(
          'dayTime',
          'boxFactoryId',
          'boxNumber'
        ),
        initApi: 'boxApi/getBoxReturnInfoInfo',
        saveApi: 'boxApi/saveBoxReturnInfo',
        updateApi: 'boxApi/updateBoxReturnInfo',
        objectName: 'boxReturnInfo'
      })

    }
  }
}
</script>
